home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
QRZ! Ham Radio 8
/
QRZ Ham Radio Callsign Database - Volume 8.iso
/
pc
/
files
/
t_unix
/
j109lxa4.tar
/
ax25mail.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-04
|
2KB
|
93 lines
/* AX25 mailbox interface
* Copyright 1991 Phil Karn, KA9Q
*
* May '91 Bill Simpson
* move to separate file for compilation & linking
*/
#include "global.h"
#include "proc.h"
#include "iface.h"
#include "pktdrvr.h"
#include "ax25.h"
#include "usock.h"
#include "socket.h"
#include "session.h"
#include "mailbox.h"
#include "ax25mail.h"
extern int Mbjumpstart;
/* Axi_sock is kept in Socket.c, so that this module won't be called */
int
ax25start(argc,argv,p)
int argc;
char *argv[];
void *p;
{
int s,whatcall;
struct usock *up;
if (Axi_sock != -1)
return 0;
psignal(Curproc,0); /* Don't keep the parser waiting */
chname(Curproc,"AX25 listener");
Axi_sock = socket(AF_AX25,SOCK_STREAM,0);
/* bind() is done automatically */
if(listen(Axi_sock,1) == -1){
close_s(Axi_sock);
return -1;
}
for(;;){
if((s = accept(Axi_sock,NULLCHAR,NULLINT)) == -1)
break; /* Service is shutting down */
#ifdef notdef
/* THIS is now done in LAPB.C - WG7J */
if(availmem() < Memthresh + 5120L) {
shutdown(s,1);
} else {
#endif
/* Spawn a server */
up = itop(s);
whatcall = up->cb.ax25->jumpstarted;
/* If jumpstart is off, then
* eat the line that triggered the connection
* and start the mailbox
*/
if(!Mbjumpstart) {
sockmode(s,SOCK_ASCII); /* To make recvline work */
recvline(s,NULLCHAR,80);
} else {
/* Check to see if jumpstart was actually used for
* this connection.
* If not, then again eat the line triggering this all
*/
if(!(whatcall&JUMPSTARTED)) {
sockmode(s,SOCK_ASCII); /* To make recvline work */
recvline(s,NULLCHAR,80);
}
}
if(newproc("mbox",2048,mbx_incom,s,(void *)whatcall,NULL,0) == NULLPROC)
close_s(s);
#ifdef notdef
}
#endif
}
close_s(Axi_sock);
Axi_sock = -1;
return 0;
}
int
ax250(argc,argv,p)
int argc;
char *argv[];
void *p;
{
close_s(Axi_sock);
Axi_sock = -1;
return 0;
}